package com.clas.liu.myapplication.network;


import android.support.v4.util.ArrayMap;
import android.util.Log;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;

/**
 * Created by liu on 2019/2/25.
 */

public class NetworkRequest {
    private ArrayMap<String,String> mRequestParam;
    private String mUrl;
    private Callback mCallback;


    public NetworkRequest(ArrayMap<String, String> businessParam, String url, Callback callback) {
        this.mRequestParam = businessParam;
        this.mUrl = url;
        this.mCallback = callback;
    }

    void sendRequest(){
        Request request = new JsonPostRequest(mUrl,mRequestParam).getRequest();
        Log.i("test", "sendRequest: "+request.body());
        Call call = NetworkManager.getInstance().getClient().newCall(request);
        call.enqueue(mCallback);
    }
}
